// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;

    @property
    text: string = 'hello';
	
	
	@property(cc.Node)
    layerNode: cc.Node = null;
	
	
	@property(cc.Prefab)
    white: cc.Prefab = null;
	
	
	@property(cc.Prefab)
    red: cc.Prefab = null;
	
	
	@property(cc.Prefab)
    blue: cc.Prefab = null;
	
	@property(cc.Prefab)
    black: cc.Prefab = null;
	
	@property
	i: number = 0;
	
	

    // LIFE-CYCLE CALLBACKS:
	
	
	 init(){
		for(var i=0;i<=20;i++){
		
			//cc.log(i)
			let node: number[] = [];  //声明数组 不赋值
			
			node[i] = cc.instantiate(this.red);
			
			node[i].x=i*100
			//node[i].y=i*100
			
			
			node[i].width=50
			node[i].height=50
			
			//cc.log(node[i].scale)
			//node[i].scale=cc.v2(3, 3)
			
			
			cc.log(node[i])
		
		
			
			this.layerNode.addChild(node[i])
		}
	 
	 
	 }

     onLoad () {
		this.init()
	 
	 
	 
		
			
			
		
	 
	 }

    start () {

    }

     update (dt) {
	 
	 }
}
